@otmc/ui 0.1.6 → 0.1.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunk-BGUL4HIW.js +410 -0
- package/dist/chunk-BGUL4HIW.js.map +1 -0
- package/dist/editor.cjs +5075 -0
- package/dist/editor.cjs.map +1 -0
- package/dist/editor.d.cts +217 -0
- package/dist/editor.d.ts +217 -0
- package/dist/editor.js +4807 -0
- package/dist/editor.js.map +1 -0
- package/dist/index.cjs +417 -128
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +27 -1
- package/dist/index.d.ts +27 -1
- package/dist/index.js +104 -203
- package/dist/index.js.map +1 -1
- package/dist/instructions-CCxIhaa6.d.cts +116 -0
- package/dist/instructions-CCxIhaa6.d.ts +116 -0
- package/package.json +91 -12
- /package/{scripts → src/scripts}/prebuild.js +0 -0
|
@@ -0,0 +1,410 @@
|
|
|
1
|
+
// src/components/common/NotificationCenter.tsx
|
|
2
|
+
import { notifications } from "@mantine/notifications";
|
|
3
|
+
import { IconX, IconAlertCircle, IconInfoCircle, IconCheck } from "@tabler/icons-react";
|
|
4
|
+
import { jsx } from "react/jsx-runtime";
|
|
5
|
+
var notificationCenter = {
|
|
6
|
+
error: ({ title, message, autoClose = 15e3 }) => {
|
|
7
|
+
notifications.show({
|
|
8
|
+
color: "red",
|
|
9
|
+
title: `${title}`,
|
|
10
|
+
message,
|
|
11
|
+
icon: /* @__PURE__ */ jsx(IconX, {}),
|
|
12
|
+
autoClose,
|
|
13
|
+
radius: "lg"
|
|
14
|
+
});
|
|
15
|
+
},
|
|
16
|
+
warn: ({ title, message, autoClose = 1e4 }) => {
|
|
17
|
+
notifications.show({
|
|
18
|
+
color: "yellow",
|
|
19
|
+
title: `${title}`,
|
|
20
|
+
message,
|
|
21
|
+
icon: /* @__PURE__ */ jsx(IconAlertCircle, {}),
|
|
22
|
+
autoClose,
|
|
23
|
+
radius: "lg"
|
|
24
|
+
});
|
|
25
|
+
},
|
|
26
|
+
info: ({ title, message, autoClose = 8e3 }) => {
|
|
27
|
+
notifications.show({
|
|
28
|
+
color: "blue",
|
|
29
|
+
title: `${title}`,
|
|
30
|
+
icon: /* @__PURE__ */ jsx(IconInfoCircle, {}),
|
|
31
|
+
message,
|
|
32
|
+
autoClose,
|
|
33
|
+
radius: "lg"
|
|
34
|
+
});
|
|
35
|
+
},
|
|
36
|
+
success: ({ title, message, autoClose = 5e3 }) => {
|
|
37
|
+
notifications.show({
|
|
38
|
+
color: "green",
|
|
39
|
+
title: `${title}`,
|
|
40
|
+
icon: /* @__PURE__ */ jsx(IconCheck, {}),
|
|
41
|
+
message,
|
|
42
|
+
autoClose,
|
|
43
|
+
radius: "lg"
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
var NotificationCenter_default = notificationCenter;
|
|
48
|
+
|
|
49
|
+
// src/api/utils.ts
|
|
50
|
+
var backendUrlOverride;
|
|
51
|
+
function setBackendUrl(url) {
|
|
52
|
+
backendUrlOverride = url;
|
|
53
|
+
}
|
|
54
|
+
function getBackendUrl() {
|
|
55
|
+
if (backendUrlOverride) return backendUrlOverride;
|
|
56
|
+
if (typeof window !== "undefined" && window.location?.origin) {
|
|
57
|
+
return window.location.origin + "/api";
|
|
58
|
+
}
|
|
59
|
+
return "";
|
|
60
|
+
}
|
|
61
|
+
var BACKEND_URL = getBackendUrl();
|
|
62
|
+
var accessTokenGetter = null;
|
|
63
|
+
function setAccessTokenGetter(getter) {
|
|
64
|
+
accessTokenGetter = getter;
|
|
65
|
+
}
|
|
66
|
+
var ApiClient = class {
|
|
67
|
+
constructor(baseUrl) {
|
|
68
|
+
this.baseUrl = baseUrl;
|
|
69
|
+
}
|
|
70
|
+
async request(endpoint, options = {}) {
|
|
71
|
+
const url = `${this.baseUrl ?? getBackendUrl()}${endpoint}`;
|
|
72
|
+
const config = {
|
|
73
|
+
headers: {
|
|
74
|
+
"Content-Type": "application/json",
|
|
75
|
+
...options.headers
|
|
76
|
+
},
|
|
77
|
+
...options
|
|
78
|
+
};
|
|
79
|
+
const token = accessTokenGetter ? await accessTokenGetter() : null;
|
|
80
|
+
if (token) {
|
|
81
|
+
config.headers.Authorization = `Bearer ${token}`;
|
|
82
|
+
}
|
|
83
|
+
try {
|
|
84
|
+
const response = await fetch(url, config);
|
|
85
|
+
if (options.method === "DELETE") {
|
|
86
|
+
if (response.status === 204 || response.status === 200) {
|
|
87
|
+
return { success: true, data: void 0, message: "Success" };
|
|
88
|
+
}
|
|
89
|
+
const text = await response.text();
|
|
90
|
+
if (text) {
|
|
91
|
+
const data = JSON.parse(text);
|
|
92
|
+
if (!response.ok) {
|
|
93
|
+
const error = data.error;
|
|
94
|
+
NotificationCenter_default.error({
|
|
95
|
+
title: `${error.summary}`,
|
|
96
|
+
message: `${error.detail}`,
|
|
97
|
+
autoClose: 15e3
|
|
98
|
+
});
|
|
99
|
+
throw new Error(`${error.summary}: ${error.detail}` || `Request Failed with status: ${response.status}`);
|
|
100
|
+
}
|
|
101
|
+
return data;
|
|
102
|
+
} else {
|
|
103
|
+
return { success: true, data: void 0, message: "Success" };
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
const responseData = await response.json();
|
|
107
|
+
if (!response.ok) {
|
|
108
|
+
const error = responseData.error;
|
|
109
|
+
NotificationCenter_default.error({
|
|
110
|
+
title: `${error.summary}`,
|
|
111
|
+
message: `${error.detail}`,
|
|
112
|
+
autoClose: 15e3
|
|
113
|
+
});
|
|
114
|
+
throw new Error(`${error.summary}: ${error.detail}` || `Request Failed with status: ${response.status}`);
|
|
115
|
+
}
|
|
116
|
+
return responseData;
|
|
117
|
+
} catch (error) {
|
|
118
|
+
console.error(`API request failed: ${endpoint}`, error);
|
|
119
|
+
throw error;
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
get(endpoint, params) {
|
|
123
|
+
const queryString = params ? `?${new URLSearchParams(params).toString()}` : "";
|
|
124
|
+
return this.request(`${endpoint}${queryString}`, { method: "GET" });
|
|
125
|
+
}
|
|
126
|
+
post(endpoint, data) {
|
|
127
|
+
return this.request(endpoint, {
|
|
128
|
+
method: "POST",
|
|
129
|
+
body: data ? JSON.stringify(data) : void 0
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
put(endpoint, data) {
|
|
133
|
+
return this.request(endpoint, {
|
|
134
|
+
method: "PUT",
|
|
135
|
+
body: data ? JSON.stringify(data) : void 0
|
|
136
|
+
});
|
|
137
|
+
}
|
|
138
|
+
patch(endpoint, data) {
|
|
139
|
+
return this.request(endpoint, {
|
|
140
|
+
method: "PATCH",
|
|
141
|
+
body: data ? JSON.stringify(data) : void 0
|
|
142
|
+
});
|
|
143
|
+
}
|
|
144
|
+
delete(endpoint) {
|
|
145
|
+
return this.request(endpoint, { method: "DELETE" });
|
|
146
|
+
}
|
|
147
|
+
};
|
|
148
|
+
var apiClient = new ApiClient();
|
|
149
|
+
var apiUtils = {
|
|
150
|
+
handleSuccess: (response) => {
|
|
151
|
+
return response.data;
|
|
152
|
+
},
|
|
153
|
+
handleError: (error) => {
|
|
154
|
+
console.error("API Error:", error);
|
|
155
|
+
throw error;
|
|
156
|
+
},
|
|
157
|
+
validateId: (id) => {
|
|
158
|
+
return /^[0-9A-HJKMNP-TV-Z]{26}$/.test(id);
|
|
159
|
+
},
|
|
160
|
+
getDataFromResponse: (response) => {
|
|
161
|
+
if (response.success && "data" in response) {
|
|
162
|
+
return response.data;
|
|
163
|
+
}
|
|
164
|
+
return void 0;
|
|
165
|
+
}
|
|
166
|
+
};
|
|
167
|
+
|
|
168
|
+
// src/api/llm.ts
|
|
169
|
+
var llmApi = {
|
|
170
|
+
generate: (data) => apiClient.post("/llm/generate", data),
|
|
171
|
+
generateDocument: (data) => apiClient.post("/llm/generate-document", data),
|
|
172
|
+
formatDocument: (templateId, data) => apiClient.post(`/llm/format/${templateId}`, data),
|
|
173
|
+
getConfig: () => apiClient.get("/llm/config"),
|
|
174
|
+
testConnection: () => apiClient.get("/llm/test"),
|
|
175
|
+
reload: () => apiClient.post("/llm/reload")
|
|
176
|
+
};
|
|
177
|
+
|
|
178
|
+
// src/api/instructions.ts
|
|
179
|
+
var instructionsApi = {
|
|
180
|
+
getAll: () => apiClient.get("/prompts"),
|
|
181
|
+
getById: (id) => apiClient.get(`/prompts/${id}`),
|
|
182
|
+
create: (instruction) => apiClient.post("/prompts", instruction),
|
|
183
|
+
update: (id, content) => apiClient.patch(`/prompts/${id}`, { content }),
|
|
184
|
+
delete: (id) => apiClient.delete(`/prompts/${id}`)
|
|
185
|
+
};
|
|
186
|
+
|
|
187
|
+
// src/contexts/ThemeProvider.tsx
|
|
188
|
+
import { createContext, useContext, useEffect, useState } from "react";
|
|
189
|
+
import {
|
|
190
|
+
useMantineColorScheme
|
|
191
|
+
} from "@mantine/core";
|
|
192
|
+
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
193
|
+
var ThemeContext = createContext(null);
|
|
194
|
+
var useTheme = () => {
|
|
195
|
+
const ctx = useContext(ThemeContext);
|
|
196
|
+
if (!ctx) {
|
|
197
|
+
throw new Error("useTheme must be used inside ThemeProvider");
|
|
198
|
+
}
|
|
199
|
+
return ctx;
|
|
200
|
+
};
|
|
201
|
+
var resolveColorScheme = (colorScheme) => {
|
|
202
|
+
if (colorScheme === "auto") {
|
|
203
|
+
return window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light";
|
|
204
|
+
}
|
|
205
|
+
return colorScheme;
|
|
206
|
+
};
|
|
207
|
+
var resolveTimeBasedTheme = (settings) => {
|
|
208
|
+
const now = /* @__PURE__ */ new Date();
|
|
209
|
+
const minutes = now.getHours() * 60 + now.getMinutes();
|
|
210
|
+
const [lh, lm] = settings.lightStartTime.split(":").map(Number);
|
|
211
|
+
const [dh, dm] = settings.darkStartTime.split(":").map(Number);
|
|
212
|
+
const light = lh * 60 + lm;
|
|
213
|
+
const dark = dh * 60 + dm;
|
|
214
|
+
return light < dark ? minutes >= light && minutes < dark ? "light" : "dark" : minutes >= light || minutes < dark ? "light" : "dark";
|
|
215
|
+
};
|
|
216
|
+
var resolveAutoScheme = () => window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light";
|
|
217
|
+
var ThemeProvider = ({
|
|
218
|
+
children,
|
|
219
|
+
defaultTheme = "auto",
|
|
220
|
+
defaultTimeBasedSettings = {
|
|
221
|
+
lightStartTime: "07:00",
|
|
222
|
+
darkStartTime: "19:00"
|
|
223
|
+
},
|
|
224
|
+
storagePrefix = ""
|
|
225
|
+
}) => {
|
|
226
|
+
const themeStorageKey = `${storagePrefix}theme`;
|
|
227
|
+
const timeStorageKey = `${storagePrefix}time-theme`;
|
|
228
|
+
const { colorScheme, setColorScheme } = useMantineColorScheme();
|
|
229
|
+
const [theme, setThemeState] = useState(
|
|
230
|
+
() => localStorage.getItem(themeStorageKey) ?? defaultTheme
|
|
231
|
+
);
|
|
232
|
+
const [timeBasedSettings, setTimeBasedSettings] = useState(
|
|
233
|
+
() => JSON.parse(localStorage.getItem(timeStorageKey) || "null") ?? defaultTimeBasedSettings
|
|
234
|
+
);
|
|
235
|
+
const handleSetTimeBasedSettings = (settings) => {
|
|
236
|
+
setTimeBasedSettings(settings);
|
|
237
|
+
localStorage.setItem(timeStorageKey, JSON.stringify(settings));
|
|
238
|
+
if (theme === "time-based") {
|
|
239
|
+
applyTheme("time-based");
|
|
240
|
+
}
|
|
241
|
+
};
|
|
242
|
+
const applyTheme = (mode) => {
|
|
243
|
+
let scheme;
|
|
244
|
+
switch (mode) {
|
|
245
|
+
case "light":
|
|
246
|
+
case "dark":
|
|
247
|
+
case "auto":
|
|
248
|
+
scheme = mode;
|
|
249
|
+
break;
|
|
250
|
+
case "time-based":
|
|
251
|
+
scheme = resolveTimeBasedTheme(timeBasedSettings);
|
|
252
|
+
break;
|
|
253
|
+
default:
|
|
254
|
+
scheme = "auto";
|
|
255
|
+
}
|
|
256
|
+
setColorScheme(scheme);
|
|
257
|
+
};
|
|
258
|
+
useEffect(() => {
|
|
259
|
+
applyTheme(theme);
|
|
260
|
+
}, [theme, timeBasedSettings]);
|
|
261
|
+
const setTheme = (mode) => {
|
|
262
|
+
setThemeState(mode);
|
|
263
|
+
localStorage.setItem(themeStorageKey, mode);
|
|
264
|
+
applyTheme(mode);
|
|
265
|
+
};
|
|
266
|
+
const toggleTheme = () => {
|
|
267
|
+
setTheme(colorScheme === "dark" ? "light" : "dark");
|
|
268
|
+
};
|
|
269
|
+
const currentTheme = theme === "time-based" ? resolveTimeBasedTheme(timeBasedSettings) : colorScheme === "auto" ? resolveAutoScheme() : colorScheme;
|
|
270
|
+
return /* @__PURE__ */ jsx2(
|
|
271
|
+
ThemeContext.Provider,
|
|
272
|
+
{
|
|
273
|
+
value: {
|
|
274
|
+
theme,
|
|
275
|
+
currentTheme,
|
|
276
|
+
setTheme,
|
|
277
|
+
toggleTheme,
|
|
278
|
+
timeBasedSettings,
|
|
279
|
+
setTimeBasedSettings: handleSetTimeBasedSettings
|
|
280
|
+
},
|
|
281
|
+
children
|
|
282
|
+
}
|
|
283
|
+
);
|
|
284
|
+
};
|
|
285
|
+
|
|
286
|
+
// src/utils/commonUtils.ts
|
|
287
|
+
var copyToClipboard = async (text) => {
|
|
288
|
+
try {
|
|
289
|
+
if (navigator.clipboard && window.isSecureContext) {
|
|
290
|
+
await navigator.clipboard.writeText(text);
|
|
291
|
+
return true;
|
|
292
|
+
}
|
|
293
|
+
const textarea = document.createElement("textarea");
|
|
294
|
+
textarea.value = text;
|
|
295
|
+
textarea.style.position = "fixed";
|
|
296
|
+
textarea.style.left = "-9999px";
|
|
297
|
+
textarea.style.top = "-9999px";
|
|
298
|
+
textarea.style.opacity = "0";
|
|
299
|
+
document.body.appendChild(textarea);
|
|
300
|
+
textarea.focus();
|
|
301
|
+
textarea.select();
|
|
302
|
+
const success = document.execCommand("copy");
|
|
303
|
+
document.body.removeChild(textarea);
|
|
304
|
+
return success;
|
|
305
|
+
} catch (err) {
|
|
306
|
+
console.error("Failed to copy to clipboard:", err);
|
|
307
|
+
return false;
|
|
308
|
+
}
|
|
309
|
+
};
|
|
310
|
+
|
|
311
|
+
// src/utils/debug.ts
|
|
312
|
+
var env = globalThis.process?.env ?? {};
|
|
313
|
+
var shouldLog = env.NODE_ENV !== "production";
|
|
314
|
+
var debugInclude = (() => {
|
|
315
|
+
try {
|
|
316
|
+
const envValue = globalThis.__OTMC_DEBUG_INCLUDE__ ?? env.OTMC_DEBUG_INCLUDE;
|
|
317
|
+
if (envValue) {
|
|
318
|
+
return JSON.parse(envValue);
|
|
319
|
+
}
|
|
320
|
+
} catch (e) {
|
|
321
|
+
console.warn("Failed to parse OTMC_DEBUG_INCLUDE:", e);
|
|
322
|
+
}
|
|
323
|
+
return [];
|
|
324
|
+
})();
|
|
325
|
+
var shouldLogForFile = (fileName) => {
|
|
326
|
+
if (!shouldLog) return false;
|
|
327
|
+
if (!fileName || debugInclude.length === 0) return true;
|
|
328
|
+
return debugInclude.some((included) => fileName.includes(included));
|
|
329
|
+
};
|
|
330
|
+
var getCallingFile = () => {
|
|
331
|
+
const stack = new Error().stack;
|
|
332
|
+
if (!stack) return void 0;
|
|
333
|
+
const lines = stack.split("\n");
|
|
334
|
+
for (let i = 3; i < lines.length; i++) {
|
|
335
|
+
const line = lines[i];
|
|
336
|
+
const match = line.match(/at .*?\((.+?):\d+:\d+\)|at (.+?):\d+:\d+/);
|
|
337
|
+
if (match) {
|
|
338
|
+
const filePath = match[1] || match[2];
|
|
339
|
+
const fileName = filePath.split("/").pop();
|
|
340
|
+
return fileName;
|
|
341
|
+
}
|
|
342
|
+
}
|
|
343
|
+
return void 0;
|
|
344
|
+
};
|
|
345
|
+
var debug = {
|
|
346
|
+
log: (...args) => {
|
|
347
|
+
const fileName = getCallingFile();
|
|
348
|
+
if (shouldLogForFile(fileName)) {
|
|
349
|
+
console.log(...args);
|
|
350
|
+
}
|
|
351
|
+
},
|
|
352
|
+
warn: (...args) => {
|
|
353
|
+
const fileName = getCallingFile();
|
|
354
|
+
if (shouldLogForFile(fileName)) {
|
|
355
|
+
console.warn(...args);
|
|
356
|
+
}
|
|
357
|
+
},
|
|
358
|
+
error: (...args) => {
|
|
359
|
+
const fileName = getCallingFile();
|
|
360
|
+
if (shouldLogForFile(fileName)) {
|
|
361
|
+
console.error(...args);
|
|
362
|
+
}
|
|
363
|
+
},
|
|
364
|
+
table: (...args) => {
|
|
365
|
+
const fileName = getCallingFile();
|
|
366
|
+
if (shouldLogForFile(fileName)) {
|
|
367
|
+
console.table(...args);
|
|
368
|
+
}
|
|
369
|
+
},
|
|
370
|
+
withFile: (fileName) => ({
|
|
371
|
+
log: (...args) => {
|
|
372
|
+
if (shouldLogForFile(fileName)) {
|
|
373
|
+
console.log(...args);
|
|
374
|
+
}
|
|
375
|
+
},
|
|
376
|
+
warn: (...args) => {
|
|
377
|
+
if (shouldLogForFile(fileName)) {
|
|
378
|
+
console.warn(...args);
|
|
379
|
+
}
|
|
380
|
+
},
|
|
381
|
+
error: (...args) => {
|
|
382
|
+
if (shouldLogForFile(fileName)) {
|
|
383
|
+
console.error(...args);
|
|
384
|
+
}
|
|
385
|
+
},
|
|
386
|
+
table: (...args) => {
|
|
387
|
+
if (shouldLogForFile(fileName)) {
|
|
388
|
+
console.table(...args);
|
|
389
|
+
}
|
|
390
|
+
}
|
|
391
|
+
})
|
|
392
|
+
};
|
|
393
|
+
|
|
394
|
+
export {
|
|
395
|
+
NotificationCenter_default,
|
|
396
|
+
setBackendUrl,
|
|
397
|
+
getBackendUrl,
|
|
398
|
+
BACKEND_URL,
|
|
399
|
+
setAccessTokenGetter,
|
|
400
|
+
apiClient,
|
|
401
|
+
apiUtils,
|
|
402
|
+
llmApi,
|
|
403
|
+
instructionsApi,
|
|
404
|
+
useTheme,
|
|
405
|
+
resolveColorScheme,
|
|
406
|
+
ThemeProvider,
|
|
407
|
+
copyToClipboard,
|
|
408
|
+
debug
|
|
409
|
+
};
|
|
410
|
+
//# sourceMappingURL=chunk-BGUL4HIW.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/components/common/NotificationCenter.tsx","../src/api/utils.ts","../src/api/llm.ts","../src/api/instructions.ts","../src/contexts/ThemeProvider.tsx","../src/utils/commonUtils.ts","../src/utils/debug.ts"],"sourcesContent":["/**\r\n * @License OTMC License\r\n * @Copyright (c) 2026 OTMC Softwares. All rights reserved.\r\n * @Contributors Trung Ng, OTMC Authors.\r\n**/\r\nimport { notifications } from '@mantine/notifications';\r\nimport { IconX, IconAlertCircle, IconInfoCircle, IconCheck } from '@tabler/icons-react';\r\n\r\ninterface NotificationOptions {\r\n title: string;\r\n message?: string;\r\n autoClose?: number;\r\n}\r\n\r\nconst notificationCenter = {\r\n error: ({ title, message, autoClose = 15000 }: NotificationOptions) => {\r\n notifications.show({\r\n color: 'red',\r\n title: `${title}`,\r\n message,\r\n icon: <IconX />,\r\n autoClose,\r\n radius: 'lg',\r\n });\r\n },\r\n\r\n warn: ({ title, message, autoClose = 10000 }: NotificationOptions) => {\r\n notifications.show({\r\n color: 'yellow',\r\n title: `${title}`,\r\n message,\r\n icon: <IconAlertCircle />,\r\n autoClose,\r\n radius: 'lg',\r\n });\r\n },\r\n\r\n info: ({ title, message, autoClose = 8000 }: NotificationOptions) => {\r\n notifications.show({\r\n color: 'blue',\r\n title: `${title}`,\r\n icon: <IconInfoCircle />,\r\n message,\r\n autoClose,\r\n radius: 'lg',\r\n });\r\n },\r\n\r\n success: ({ title, message, autoClose = 5000 }: NotificationOptions) => {\r\n notifications.show({\r\n color: 'green',\r\n title: `${title}`,\r\n icon: <IconCheck />,\r\n message,\r\n autoClose,\r\n radius: 'lg',\r\n });\r\n },\r\n};\r\n\r\nexport default notificationCenter;\r\n","/**\r\n * @License OTMC License\r\n * @Copyright (c) 2026 OTMC Softwares. All rights reserved.\r\n * @Contributors Trung Ng, OTMC Authors.\r\n**/\r\n\r\nimport notificationCenter from \"../components/common/NotificationCenter\";\r\n\r\nlet backendUrlOverride: string | undefined;\r\n\r\nexport function setBackendUrl(url: string) {\r\n backendUrlOverride = url;\r\n}\r\n\r\nexport function getBackendUrl(): string {\r\n if (backendUrlOverride) return backendUrlOverride;\r\n if (typeof window !== 'undefined' && window.location?.origin) {\r\n return window.location.origin + \"/api\";\r\n }\r\n return \"\";\r\n}\r\n\r\nexport const BACKEND_URL = getBackendUrl();\r\n\r\nlet accessTokenGetter: (() => Promise<string | null>) | null = null;\r\n\r\nexport function setAccessTokenGetter(getter: () => Promise<string | null>) {\r\n accessTokenGetter = getter;\r\n}\r\n\r\nexport interface SuccessResponse<T> {\r\n success: boolean;\r\n data: T;\r\n message?: string;\r\n}\r\n\r\nexport interface ErrorResponse {\r\n success: boolean;\r\n error: {\r\n code: number;\r\n key: string;\r\n type: string;\r\n\r\n summary: string;\r\n detail: string;\r\n file?: string;\r\n line?: number;\r\n function?: string;\r\n timestamp?: string;\r\n };\r\n}\r\n\r\nexport type ApiResponse<T> = SuccessResponse<T> | ErrorResponse;\r\n\r\nclass ApiClient {\r\n private baseUrl?: string;\r\n\r\n constructor(baseUrl?: string) {\r\n this.baseUrl = baseUrl;\r\n }\r\n\r\n private async request<T>(\r\n endpoint: string,\r\n options: RequestInit = {}\r\n ): Promise<ApiResponse<T>> {\r\n const url = `${this.baseUrl ?? getBackendUrl()}${endpoint}`;\r\n\r\n const config: RequestInit = {\r\n headers: {\r\n 'Content-Type': 'application/json',\r\n ...options.headers,\r\n },\r\n ...options,\r\n };\r\n\r\n const token = accessTokenGetter ? await accessTokenGetter() : null;\r\n if (token) {\r\n (config.headers as Record<string, string>).Authorization = `Bearer ${token}`;\r\n }\r\n\r\n try {\r\n const response = await fetch(url, config);\r\n\r\n if (options.method === 'DELETE') {\r\n if (response.status === 204 || response.status === 200) {\r\n return { success: true, data: undefined as unknown as T, message: 'Success' };\r\n }\r\n const text = await response.text();\r\n if (text) {\r\n const data: ApiResponse<T> = JSON.parse(text);\r\n if (!response.ok) {\r\n const error = (data as ErrorResponse).error;\r\n notificationCenter.error({\r\n title: `${error.summary}`,\r\n message: `${error.detail}`,\r\n autoClose: 15000,\r\n });\r\n throw new Error(`${error.summary}: ${error.detail}` || `Request Failed with status: ${response.status}`);\r\n }\r\n return data;\r\n } else {\r\n return { success: true, data: undefined as unknown as T, message: 'Success' };\r\n }\r\n }\r\n\r\n const responseData: ApiResponse<T> = await response.json();\r\n\r\n if (!response.ok) {\r\n const error = (responseData as ErrorResponse).error;\r\n notificationCenter.error({\r\n title: `${error.summary}`,\r\n message: `${error.detail}`,\r\n autoClose: 15000,\r\n });\r\n throw new Error(`${error.summary}: ${error.detail}` || `Request Failed with status: ${response.status}`);\r\n }\r\n\r\n return responseData;\r\n } catch (error) {\r\n console.error(`API request failed: ${endpoint}`, error);\r\n throw error;\r\n }\r\n }\r\n\r\n get<T>(endpoint: string, params?: Record<string, string>) {\r\n const queryString = params ? `?${new URLSearchParams(params).toString()}` : '';\r\n return this.request<T>(`${endpoint}${queryString}`, { method: 'GET' });\r\n }\r\n\r\n post<T>(endpoint: string, data?: unknown) {\r\n return this.request<T>(endpoint, {\r\n method: 'POST',\r\n body: data ? JSON.stringify(data) : undefined,\r\n });\r\n }\r\n\r\n put<T>(endpoint: string, data?: unknown) {\r\n return this.request<T>(endpoint, {\r\n method: 'PUT',\r\n body: data ? JSON.stringify(data) : undefined,\r\n });\r\n }\r\n\r\n patch<T>(endpoint: string, data?: unknown) {\r\n return this.request<T>(endpoint, {\r\n method: 'PATCH',\r\n body: data ? JSON.stringify(data) : undefined,\r\n });\r\n }\r\n\r\n delete<T>(endpoint: string) {\r\n return this.request<T>(endpoint, { method: 'DELETE' });\r\n }\r\n}\r\n\r\nexport const apiClient = new ApiClient();\r\n\r\nexport const apiUtils = {\r\n handleSuccess: <T>(response: SuccessResponse<T>): T => {\r\n return response.data;\r\n },\r\n\r\n handleError: (error: unknown): void => {\r\n console.error('API Error:', error);\r\n throw error;\r\n },\r\n\r\n validateId: (id: string): boolean => {\r\n return /^[0-9A-HJKMNP-TV-Z]{26}$/.test(id);\r\n },\r\n\r\n getDataFromResponse: <T>(response: ApiResponse<T>): T | undefined => {\r\n if (response.success && 'data' in response) {\r\n return response.data;\r\n }\r\n return undefined;\r\n },\r\n};\r\n","/**\r\n * @License OTMC License\r\n * @Copyright (c) 2026 OTMC Softwares. All rights reserved.\r\n * @Contributors Trung Ng, OTMC Authors.\r\n**/\r\n\r\nimport { apiClient } from './utils';\r\n\r\nexport interface LLMRequest {\r\n type: string;\r\n prompt: string;\r\n content: string;\r\n}\r\n\r\nexport interface LLMResponse {\r\n type: string;\r\n response: string;\r\n}\r\n\r\nexport interface GenerateDocumentRequest {\r\n prompt: string;\r\n}\r\n\r\nexport interface GenerateDocumentResponse {\r\n content: string;\r\n}\r\n\r\nexport interface FormatDocumentRequest {\r\n doc_id?: number | null;\r\n title?: string | null;\r\n content: string;\r\n}\r\n\r\nexport interface FormatDocumentResponse {\r\n content: string;\r\n}\r\n\r\nexport interface LLMTestResponse {\r\n message: string;\r\n}\r\n\r\nexport interface LLMReloadResponse {\r\n status: string;\r\n message: string;\r\n provider: string;\r\n}\r\n\r\nexport interface LLMConfigResponse {\r\n status: string;\r\n}\r\n\r\nexport const llmApi = {\r\n generate: (data: LLMRequest) =>\r\n apiClient.post<LLMResponse & { content?: string }>('/llm/generate', data),\r\n\r\n generateDocument: (data: GenerateDocumentRequest) =>\r\n apiClient.post<GenerateDocumentResponse>('/llm/generate-document', data),\r\n\r\n formatDocument: (templateId: number, data: FormatDocumentRequest) =>\r\n apiClient.post<FormatDocumentResponse>(`/llm/format/${templateId}`, data),\r\n\r\n getConfig: () =>\r\n apiClient.get<LLMConfigResponse>('/llm/config'),\r\n\r\n testConnection: () =>\r\n apiClient.get<LLMTestResponse>('/llm/test'),\r\n\r\n reload: () =>\r\n apiClient.post<LLMReloadResponse>('/llm/reload'),\r\n};\r\n","/**\r\n * @License OTMC License\r\n * @Copyright (c) 2026 OTMC Softwares. All rights reserved.\r\n * @Contributors Trung Ng, OTMC Authors.\r\n**/\r\n\r\nimport { apiClient } from './utils'\r\n\r\nexport interface Instruction {\r\n id: number\r\n name: string\r\n content: string\r\n}\r\n\r\nexport const instructionsApi = {\r\n getAll: () => apiClient.get<Instruction[]>('/prompts'),\r\n\r\n getById: (id: number) => apiClient.get<Instruction>(`/prompts/${id}`),\r\n\r\n create: (instruction: Omit<Instruction, 'id'>) =>\r\n apiClient.post<Instruction>('/prompts', instruction),\r\n\r\n update: (id: number, content: string) =>\r\n apiClient.patch<Instruction>(`/prompts/${id}`, { content }),\r\n\r\n delete: (id: number) =>\r\n apiClient.delete(`/prompts/${id}`)\r\n}\r\n","/**\n * @License OTMC License\n * @Copyright (c) 2026 OTMC Softwares. All rights reserved.\n * @Contributors Trung Ng, OTMC Authors.\n**/\n\nimport React, { createContext, useContext, useEffect, useState } from 'react';\nimport {\n useMantineColorScheme,\n type MantineColorScheme,\n} from '@mantine/core';\n\nexport type ThemeMode = 'light' | 'dark' | 'auto' | 'time-based';\n\nexport interface TimeBasedSettings {\n lightStartTime: string;\n darkStartTime: string;\n}\n\nexport interface ThemeProviderProps {\n children: React.ReactNode;\n defaultTheme?: ThemeMode;\n defaultTimeBasedSettings?: TimeBasedSettings;\n storagePrefix?: string;\n}\n\nexport interface ThemeContextType {\n theme: ThemeMode;\n currentTheme: 'light' | 'dark';\n setTheme: (theme: ThemeMode) => void;\n toggleTheme: () => void;\n timeBasedSettings: TimeBasedSettings;\n setTimeBasedSettings: (v: TimeBasedSettings) => void;\n}\n\nconst ThemeContext = createContext<ThemeContextType | null>(null);\n\nexport const useTheme = () => {\n const ctx = useContext(ThemeContext);\n if (!ctx) {\n throw new Error('useTheme must be used inside ThemeProvider');\n }\n return ctx;\n};\n\nexport const resolveColorScheme = (colorScheme: 'light' | 'dark' | 'auto'): 'light' | 'dark' => {\n if (colorScheme === 'auto') {\n return window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light';\n }\n return colorScheme;\n};\n\nconst resolveTimeBasedTheme = (\n settings: TimeBasedSettings\n): 'light' | 'dark' => {\n const now = new Date();\n const minutes = now.getHours() * 60 + now.getMinutes();\n\n const [lh, lm] = settings.lightStartTime.split(':').map(Number);\n const [dh, dm] = settings.darkStartTime.split(':').map(Number);\n\n const light = lh * 60 + lm;\n const dark = dh * 60 + dm;\n\n return light < dark\n ? minutes >= light && minutes < dark\n ? 'light'\n : 'dark'\n : minutes >= light || minutes < dark\n ? 'light'\n : 'dark';\n};\n\nconst resolveAutoScheme = (): 'light' | 'dark' =>\n window.matchMedia('(prefers-color-scheme: dark)').matches\n ? 'dark'\n : 'light';\n\nexport const ThemeProvider: React.FC<ThemeProviderProps> = ({\n children,\n defaultTheme = 'auto',\n defaultTimeBasedSettings = {\n lightStartTime: '07:00',\n darkStartTime: '19:00',\n },\n storagePrefix = '',\n}) => {\n const themeStorageKey = `${storagePrefix}theme`;\n const timeStorageKey = `${storagePrefix}time-theme`;\n\n const { colorScheme, setColorScheme } = useMantineColorScheme();\n\n const [theme, setThemeState] = useState<ThemeMode>(\n () => (localStorage.getItem(themeStorageKey) as ThemeMode) ?? defaultTheme\n );\n\n const [timeBasedSettings, setTimeBasedSettings] =\n useState<TimeBasedSettings>(() =>\n JSON.parse(localStorage.getItem(timeStorageKey) || 'null') ??\n defaultTimeBasedSettings\n );\n\n const handleSetTimeBasedSettings = (settings: TimeBasedSettings) => {\n setTimeBasedSettings(settings);\n localStorage.setItem(timeStorageKey, JSON.stringify(settings));\n if (theme === 'time-based') {\n applyTheme('time-based');\n }\n };\n\n const applyTheme = (mode: ThemeMode) => {\n let scheme: MantineColorScheme;\n\n switch (mode) {\n case 'light':\n case 'dark':\n case 'auto':\n scheme = mode;\n break;\n case 'time-based':\n scheme = resolveTimeBasedTheme(timeBasedSettings);\n break;\n default:\n scheme = 'auto';\n }\n\n setColorScheme(scheme);\n };\n\n useEffect(() => {\n applyTheme(theme);\n }, [theme, timeBasedSettings]);\n\n const setTheme = (mode: ThemeMode) => {\n setThemeState(mode);\n localStorage.setItem(themeStorageKey, mode);\n applyTheme(mode);\n };\n\n const toggleTheme = () => {\n setTheme(colorScheme === 'dark' ? 'light' : 'dark');\n };\n\n const currentTheme: 'light' | 'dark' =\n theme === 'time-based'\n ? resolveTimeBasedTheme(timeBasedSettings)\n : colorScheme === 'auto'\n ? resolveAutoScheme()\n : colorScheme;\n\n return (\n <ThemeContext.Provider\n value={{\n theme,\n currentTheme,\n setTheme,\n toggleTheme,\n timeBasedSettings,\n setTimeBasedSettings: handleSetTimeBasedSettings,\n }}\n >\n {children}\n </ThemeContext.Provider>\n );\n};\n","/**\n * @License OTMC License\n * @Copyright (c) 2026 OTMC Softwares. All rights reserved.\n * @Contributors Trung Ng, OTMC Authors.\n**/\nexport const copyToClipboard = async (text: string): Promise<boolean> => {\n try {\n if (navigator.clipboard && window.isSecureContext) {\n await navigator.clipboard.writeText(text);\n return true;\n }\n \n const textarea = document.createElement('textarea');\n textarea.value = text;\n textarea.style.position = 'fixed';\n textarea.style.left = '-9999px';\n textarea.style.top = '-9999px';\n textarea.style.opacity = '0';\n document.body.appendChild(textarea);\n textarea.focus();\n textarea.select();\n \n const success = document.execCommand('copy');\n document.body.removeChild(textarea);\n \n return success;\n } catch (err) {\n console.error('Failed to copy to clipboard:', err);\n return false;\n }\n};\n","/**\r\n * @License OTMC License\r\n * @Copyright (c) 2026 OTMC Softwares. All rights reserved.\r\n * @Contributors Trung Ng, OTMC Authors.\r\n**/\r\nconst env: Record<string, string | undefined> =\r\n ((globalThis as any).process?.env as Record<string, string | undefined>) ?? {};\r\n\r\nconst shouldLog = env.NODE_ENV !== 'production';\r\n\r\nconst debugInclude = (() => {\r\n try {\r\n const envValue =\r\n (globalThis as any).__OTMC_DEBUG_INCLUDE__ ?? env.OTMC_DEBUG_INCLUDE;\r\n if (envValue) {\r\n return JSON.parse(envValue);\r\n }\r\n } catch (e) {\r\n console.warn('Failed to parse OTMC_DEBUG_INCLUDE:', e);\r\n }\r\n return [];\r\n})();\r\n\r\nconst shouldLogForFile = (fileName?: string): boolean => {\r\n if (!shouldLog) return false;\r\n if (!fileName || debugInclude.length === 0) return true;\r\n return debugInclude.some((included: string) => fileName.includes(included));\r\n};\r\n\r\nconst getCallingFile = (): string | undefined => {\r\n const stack = new Error().stack;\r\n if (!stack) return undefined;\r\n\r\n const lines = stack.split('\\n');\r\n for (let i = 3; i < lines.length; i++) {\r\n const line = lines[i];\r\n const match = line.match(/at .*?\\((.+?):\\d+:\\d+\\)|at (.+?):\\d+:\\d+/);\r\n if (match) {\r\n const filePath = match[1] || match[2];\r\n const fileName = filePath.split('/').pop();\r\n return fileName;\r\n }\r\n }\r\n return undefined;\r\n};\r\n\r\nexport const debug = {\r\n log: (...args: any[]) => {\r\n const fileName = getCallingFile();\r\n if (shouldLogForFile(fileName)) {\r\n console.log(...args);\r\n }\r\n },\r\n warn: (...args: any[]) => {\r\n const fileName = getCallingFile();\r\n if (shouldLogForFile(fileName)) {\r\n console.warn(...args);\r\n }\r\n },\r\n error: (...args: any[]) => {\r\n const fileName = getCallingFile();\r\n if (shouldLogForFile(fileName)) {\r\n console.error(...args);\r\n }\r\n },\r\n table: (...args: any[]) => {\r\n const fileName = getCallingFile();\r\n if (shouldLogForFile(fileName)) {\r\n console.table(...args);\r\n }\r\n },\r\n withFile: (fileName: string) => ({\r\n log: (...args: any[]) => {\r\n if (shouldLogForFile(fileName)) {\r\n console.log(...args);\r\n }\r\n },\r\n warn: (...args: any[]) => {\r\n if (shouldLogForFile(fileName)) {\r\n console.warn(...args);\r\n }\r\n },\r\n error: (...args: any[]) => {\r\n if (shouldLogForFile(fileName)) {\r\n console.error(...args);\r\n }\r\n },\r\n table: (...args: any[]) => {\r\n if (shouldLogForFile(fileName)) {\r\n console.table(...args);\r\n }\r\n },\r\n }),\r\n};\r\n"],"mappings":";AAKA,SAAS,qBAAqB;AAC9B,SAAS,OAAO,iBAAiB,gBAAgB,iBAAiB;AActD;AANZ,IAAM,qBAAqB;AAAA,EACzB,OAAO,CAAC,EAAE,OAA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